const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
const {CleanWebpackPlugin} = require("clean-webpack-plugin");
console.log(path.resolve())
module.exports = {
    entry: path.resolve("src", 'main.ts'), mode: "development", module: {
        rules: [{
            test: /\.ts?$/, use: 'ts-loader', exclude: /node_modules/
        }]
    }, devServer: {
        compress: true, hot: true, client: {
            progress: true,
        },
    }, resolve: {
        extensions: ['.tsx', '.ts', '.js']
    }, output: {
        filename: 'bundle.js', path: path.resolve('dist')
    }, plugins: [new CleanWebpackPlugin({
        cleanOnceBeforeBuildPatterns: [path.resolve("dist")]
    }), new htmlWebpackPlugin({
        template: path.resolve('public', "index.html"),
        filename: 'index.html',
        inject: false,
        title: 'TS Challenges',
        chunks: ['main']
    })]
};